<!DOCTYPE html>
<html>
	<head>
		<script type="text/javascript" src="js/proto.js"></script>
	</head>
	<body>
		<div class="totalContainer">
			<div>ffdf</div>
			<div>ffdf</div>
			<div>ffdf<br/>fdsfd</div>
			<div>ffdf</div>
			<div>ffdf</div>
			<div>ffdf<br/>fdsfd</div>
			<div>ffdf</div>
			<div>ffdf</div>
			<div>ffdf<br/>fdsfd</div>
			<div>ffdf</div>
			<div>ffdf</div>
			<div>ffdf<br/>fdsfd</div>
			<div>ffdf<br/>fdsfd</div>
			<div>ffdf</div>
			<div>ffdf</div>
			<div>ffdf<br/>fdsfd</div>
		</div>
		<input type="number"/>
	</body>
	<style type="text/css">
		.totalContainer {
		  display: grid;
		  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
		  grid-row-gap: 10px;
		  grid-column-gap: 10px;
		}
		.totalContainer div {
		  display: inline-block;
		  background-color: blue;
		}
		input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
		  -webkit-appearance: none;
		}
		input[type='number'] {
		  -moz-appearance: textfield;
		}
	</style>
	<script type="text/javascript">
		let array = [1,2,3,{name:'zhangsan'},'dd'];
		let array2 = array.deepClone();
		//var aaaa = `fdsff${Number.parseInt('2222')*2}`
		array.empty();
		console.log('after clear',array, array2,array2[0])
		array2.splice(0,1,'fd')
		console.log('after clear',array2)
		var obj = {
			name: 'l',
			stu:{
				name: 'ddf',
				age: 3
			},
			fetchSave: function() {
				if(true) {
					var that = this
					var content =`<p><img src="https://www.jb51.net/images/logo.gif" alt="" width="142" height="55" /></p>`
					content.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function (match, capture) {
					  console.log(capture);
					  that.postToService()
					});
				} else {
					
				}
			},
			postToService: function() {
				console.log('this', this)
			} 
		}
		obj.fetchSave();
		console.log(new Number(100).add(100).add(100).add(100).add(100))
		console.log(obj['stu.name']);
		function formatCurrency(num) {
			num = num.toString().replace(/[^\d\.-]/g,''); //转成字符串并去掉其中除数字, . 和 - 之外的其它字符。
			if(isNaN(num)) num = "0"; //是否非数字值
			var sign = (num == (num = Math.abs(num)));
			num = Math.floor(num * 100 + 0.50000000001); //下舍入
			var cents = num % 100; //求余 余数 = 被除数 - 除数 * 商
			cents = (cents < 10) ? "0" + cents : cents; //小于2位数就补齐
			num = Math.floor(num / 100).toString();
			for(var i = 0; i < Math.floor( (num.length - (1+i)) / 3 ); i++ ){ //每隔三位小数分始开隔
				num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
			}
			//return (((sign) ? '' : '-' ) + num + '.' + cents);
			return (((sign) ? '' : '-' ) + num);
		}
		console.log(new Number(1234645655844).formatCurrency());
		function toContent() {
			
			let htmlStr = "<h1>XXdffdX<h1/>";
 
			let pattern = /<.+?>(.+?)<.+?>/;
			htmlStr.replace(pattern, function(match, capture){
				alert(capture);
			});
		}
		toContent();
	</script>
</html>